package com.flow.demo.module.gd.dal.mysql.activities;

import java.util.*;

import com.flow.demo.framework.common.pojo.PageResult;
import com.flow.demo.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.flow.demo.framework.mybatis.core.mapper.BaseMapperX;
import com.flow.demo.module.gd.dal.dataobject.activities.ActivitiesDO;
import org.apache.ibatis.annotations.Mapper;
import com.flow.demo.module.gd.controller.admin.activities.vo.*;

/**
 * 活动 Mapper
 *
 * @author Pompey_hpy
 */
@Mapper
public interface ActivitiesMapper extends BaseMapperX<ActivitiesDO> {

    default PageResult<ActivitiesDO> selectPage(ActivitiesPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ActivitiesDO>()
                .likeIfPresent(ActivitiesDO::getName, reqVO.getName())
                .eqIfPresent(ActivitiesDO::getRules, reqVO.getRules())
                .eqIfPresent(ActivitiesDO::getState, reqVO.getState())
                .eqIfPresent(ActivitiesDO::getBgImage, reqVO.getBgImage())
                .betweenIfPresent(ActivitiesDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ActivitiesDO::getId));
    }

}